package com.zhou.gulimall.search.vo;

import lombok.Data;

import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @Description:
 * @Created: with IntelliJ IDEA.
 * @author: 夏沫止水
 * @createTime: 2020-06-18 09:39
 **/

@Data
public class AttrResponseVo {

    /**
     * 属性id
     */
    private Long attrId;
    /**
     * 属性名
     */
    private String attrName;
    /**
     * 是否需要检索[0-不需要，1-需要]
     */
    private Integer searchType;
    /**
     * 属性图标
     */
    private String icon;
    /**
     * 可选值列表[用逗号分隔]
     */
    private String valueSelect;
    /**
     * 属性类型[0-销售属性，1-基本属性，2-既是销售属性又是基本属性]
     */
    private Integer attrType;
    /**
     * 启用状态[0 - 禁用，1 - 启用]
     */
    private Long enable;
    /**
     * 所属分类
     */
    private Long catelogId;
    /**
     * 快速展示【是否展示在介绍上；0-否 1-是】，在sku中仍然可以调整
     */
    private Integer showDesc;

    private Long attrGroupId;

    private String catelogName;

    private String groupName;

    private Long[] catelogPath;

    private AttrResponseVo(String name, Integer count){
        this.attrName = name;
        this.attrType = count;
    }

    public static void main(String[] args) {
        LinkedList<AttrResponseVo> list = new LinkedList<>();
        list.add(new AttrResponseVo("张三", null));
        list.add(new AttrResponseVo("哈哈", 33));
        list.add(new AttrResponseVo("王五", null));
        List<AttrResponseVo> menuList = list.stream().sorted(Comparator.comparingInt(o -> Objects.isNull(o.getAttrType()) ? 0 : o.getAttrType())).collect(Collectors.toList());
        System.out.println(menuList);
    }
}
